/*
 * 作者: 侯晓宇
 * 时间: 2017-01-24
 * 说明：
 * Copyright (c) 2016-2017 中研沃兮
 */
define(function(require) {
	require("jquery");

	var c = require('app/utils/CommonUtils');
	var win = window;
	var destPath = "fs://imageClip/result_"+(new Date()).getTime()+".png";

	var action = {};

	action.close = function() {
		api.closeFrame({
			name: api.frameName
		});
	}

	action.save = function(path) {
		return new Promise(function(resolve, reject) {
			var FNImageClip = api.require('FNImageClip');
			FNImageClip.save({
				destPath: destPath,
				copyToAlbum: false,
				quality: 1
			}, function(ret, err) {
				if(ret){
					resolve(ret.destPath);
				}
			});
		});
	}

	return action;
});